<?php 
require_once("include/conn.php");
require_once("include/config.php");

function reverse_strrchr($haystack, $needle, $trail) {
   return strrpos($haystack, $needle) ? substr($haystack, 0, strrpos($haystack, $needle) + $trail) : false;
}


if(!empty($_GET[id])){
$id=$_GET[id];
}
if(!empty($_GET[c_id])){
$c_id=$_GET[c_id];
}
if(!empty($_GET[nname])){
$nname=$_GET[nname];
}
if(!empty($_GET[name])){
$nname=$_GET[name];
}
if(!empty($id)){

if($nname==3){
$sql="select * from $tb_dt where id = $id";
$cn=mysql_db_query($db_name,$sql);
$row = mysql_fetch_row($cn); 
$cname="动态信息";

$sql_all="select * from $tb_dt ORDER BY tdate DESC  limit 10";
$cn_all=mysql_db_query($db_name,$sql_all);
}
elseif($nname==4){
$sql="select * from $tb_rw where id = $id";
$cn=mysql_db_query($db_name,$sql);
$row = mysql_fetch_row($cn); 
$cname="任务指标";

$sql_all="select * from $tb_rw ORDER BY tdate DESC  limit 10";
$cn_all=mysql_db_query($db_name,$sql_all);
}
elseif($nname==6){
$sql="select * from $tb_dz where id = $id";
$cn=mysql_db_query($db_name,$sql);
$row = mysql_fetch_row($cn);
$cname="办理站文电";

$sql_all="select * from $tb_dz ORDER BY tdate DESC limit 10 ";
$cn_all=mysql_db_query($db_name,$sql_all);
 
}

/* if($nname==120){
$sql="select * from $tb_rk where id = $id";
$cn=mysql_db_query($db_name,$sql);
$row = mysql_fetch_row($cn); 
$cname="日况信息";
//$c_name=$row[6];

$sql_all="select * from $tb_rk ORDER BY tdate DESC  limit 10";
$cn_all=mysql_db_query($db_name,$sql_all);
//获取列数字
$wdbl_li=floor($row[7]);

//获取车数字
$wdbl_che=substr(strrchr($row[7],'.'),1);
if ($wdbl_li!=0 and $wdbl_che!=0)
{
$wdbl=$wdbl_li."列".$wdbl_che."车";
}

elseif ($wdbl_che!=0)
{
$wdbl=$wdbl_che."车";
}
elseif ($wdbl_li!=0)
{
$wdbl=$wdbl_li."列";
}
else 
{
$wdbl="列";
}
	} */

elseif($nname==2){
$sql="select * from $tb_fw where id = $id";
$cn=mysql_db_query($db_name,$sql);
$row = mysql_fetch_row($cn); 
$cname="提供服务";
$c_name=$row[6];

$sql_all="select * from $tb_fw ORDER BY tdate DESC  limit 10";
$cn_all=mysql_db_query($db_name,$sql_all);
}
elseif($nname==5){
$sql="select * from $tb_zg where id = $id";
$cn=mysql_db_query($db_name,$sql);
$row = mysql_fetch_row($cn); 
$cname="职工天地";
$c_name=$row[6];


$sql_all="select * from $tb_zg ORDER BY tdate DESC  limit 10";
$cn_all=mysql_db_query($db_name,$sql_all);
}
else
{
echo "<script language='javascript'>";
echo "self.location="."'"."index.php'";
echo "</script>";
}
//$row_dt = mysql_fetch_row($cn_dt); 
	
// $title =$row_dt[1];   

//转换日期成中文
function changch($date){
$ar= split("-",$date);   
$tdate= $ar[0]."年".$ar[1]."月".$ar[2]."日";
return $tdate;
 }
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title><?php echo $row[1] ?></title>
<link href="images/bj.css" rel="stylesheet" type="text/css">

</head>

<body>
 <?php
		 include("include/dttop.php"); 
	 		
			?>	
			
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="1" bgcolor="#66CCFF"></td>
  </tr>
</table>
<table width="780" height="283" border="0" align="center" cellpadding="0" cellspacing="0" class="whitebg">
<tr class="style1">
    <td height="36" colspan="3" >&nbsp;</td>
  </tr>
  <?php if($row[9]!=1 ){?>
  <tr>
    <th height="120" colspan="3" align="center" class="djs_head">
	<?php 
	if($nname==3 )
	{
	echo "<img src='images/b_zqqb.gif'>";
	}
	else if($nname==6 )
	{
	
	echo "<img src='images/b_bzwd.gif'>";
				
	}
	else
	{
	if(!empty($cname)){
	
	if(!empty($c_name)){
	echo "[<font color=red>".$c_name."</font>]";
	}else{
	echo "[<font color=red>".$cname."</font>]";
	}
	}
	
	echo $row[1];
	
	}
	?></th>
  </tr>
  <?php }?>
  <tr class="style1">
    <td height="36" colspan="3" >&nbsp;</td>
  </tr>
  <tr>
    <td height="12" colspan="3">
	<table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr class="fansong3">
       <?php
	   if($nname==6  ){
	   
	   //前设置为必须输入准字号。
	   if($row[9]==1)
	  {
	  echo "<td width='65%' align='center'>$row[2]</td><td width='35%' align='right'>编号：$row[8]&nbsp;&nbsp;</td>";
	  }
	  else
	  {
	  if($row[10]!="")
	  {
	  echo "<td align='center'>$row[8]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;签发人：$row[10]</td>";
	  }
	   else{ 
	  echo "<td align='center'>$row[8]</td>";
	  		
			}
	   }
	   }
	   else {?>
	    <td align='left'>
		<?php echo $webname;?>
		</td>		
        <td align="center"><?php
		 if($nname==120) {echo changch($row[2]);} else{echo changch($row[4]);}
		 ?></td>
		 <?php }?>
      </tr>
      <tr>
    <td height="10" colspan="2" valign="top" class="style1">
	<!-- 一般通知不显示红线 -->
	<?php  if($row[9]!=1)
	  {?>
	<hr align="center" size="1" noshade color="#FF0000" >
	<?php }?>
	</td>
  </tr>
    </table>
	</td>
  </tr>
 
  
  <tr>
    <td height="21" colspan="3" valign="top" class="style1">&nbsp;</td>
  </tr>
  <tr>
    <td height="21" colspan="3" valign="top" class="style1">&nbsp;</td>
  </tr>
  <tr>
    <td height="500" colspan="3" valign="top" class="showcontent">
	
	

	
	<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr height="26" class="style1">
    <td>&nbsp;</td>
  </tr>
  <tr align="center"   class="fansong3">
    <td><b><big><?php echo $row[1]; ?></big></b></td>
  </tr>
  <tr height="36" class="style1">
    <td>&nbsp;</td>
  </tr>
</table>
	
	<?
	echo $row[3]; 
	
	
	
	//echo htmlspecialchars($row[3]);   加上这个代码就是原样显示，不解释html代码。
	?>
	
	</td>
  </tr>
  <tr class="fansong3">
    <td height="26">&nbsp;</td>
  </tr>
  <?php if($nname==6 and $row[9]!=1 ) {
  if(!empty($row[5])){
  ?>
  <!-- 主题词 开始-->
  <!-- 主题词，用程序检查是否有值，如果没有则不显示-->
  <tr>
    <td height="26" colspan="3" >&nbsp;</td>
  </tr>
  <tr  class="fansong3">
    <td width="92" height="26" ><strong>主题词：</strong></td>
    <td width="452" height="26" ><?php echo $row[5]; ?></td>
    <td width="236" height="26" >&nbsp;</td>
  </tr> 
  <tr>
    <td height="10" valign="top" class="style1" colspan="4"><hr align="center" size="1" noshade ></td>
  </tr>
  <tr class="fansong3">
    <td height="26" colspan="3" >&nbsp;</td>
  </tr>
   <!-- 主题词 结束-->
  <?php if($row[6]!="") {?>
    <!-- 抄送 开始-->
   <tr  class="fansong3">
    <td height="26" colspan="2" >&nbsp;&nbsp;抄送：<?php echo $row[6]; ?></td>
    <td >&nbsp;</td>
  </tr>
  
  <tr>
    <td height="10" valign="top" class="style1" colspan="4"><hr align="center" size="1" noshade  ></td>
  </tr>
  <tr class="fansong3">
    <td height="26" colspan="3" >&nbsp;</td>
  </tr>
  
   <!-- 抄送 结束--> 
   
   
   <?php }
   }
   /* }else{ */
   ?>
   <!-- 单位和日期显示 开始-->
   <tr>
    <td height="26" colspan="3" >
	<table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr class="fansong3">
        <td width="22" align="left">&nbsp;</td>
        <td width="522" align="left"><?php echo $webname;?></td>
        <td width="236" align="right"><?php echo changch($row[4]);?>&nbsp;印发&nbsp;&nbsp;</td>
        </tr>
      <tr>
    <td height="10" valign="top" class="style1" colspan="3"><hr align="center" size="1" noshade ></td>
  </tr>
    </table>
	</td>
  </tr>
   <!-- 单位和日期显示 结束-->
  <?php 
  }
  ?>
  <tr>
    <td height="26" colspan="3" >&nbsp;</td>
  </tr>
  
  
  <tr>
    <td height="1" colspan="3" bgcolor="#33CCFF"></td>
  </tr>
  <tr>
    <td height="12" colspan="3">
	<table width="780"  border="0" cellspacing="0" cellpadding="0">
      <tr class="style1">
        <td width="161">&nbsp;</td>
        <td width="161">&nbsp;</td>
        <td width="293">&nbsp;</td>
        <td width="103">【<a href="javascript:window.print()" >打印</a>】</td>
        <td width="62">【<a href="javascript:window.close()">关闭</a>】</td>
      </tr>
    </table>
	</td>
  </tr>
</table>
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0" class="whitebg">
  <tr>
    <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="style1">&nbsp;</td>
      </tr>
      <tr>
        <td bgcolor="#0066CC" class="whitetxt">相关信息</td>
      </tr>
      <tr>
        <td class="style1"  >&nbsp;</td>
      </tr>
    </table>
      <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="style1">
        <?php 
		 while($row_all = mysql_fetch_array($cn_all)){
		 ?>
        <tr>
          <td><a href="dtshow.php?id=<?php echo $row_all[id]; ?>&c_id=<?php echo $c_id; ?>&nname=<?php echo $nname; ?>" target='_blank'><?php echo substr_cut($row_all[title],56) ;?></a></td>
          <?php }?>
        </tr>
        <tr>
          <td class="style1">&nbsp;</td>
        </tr>
      </table></td>
  </tr>
</table>
<?php include("include/dtbot.php");	?>
</body>
</html>
<?php }
else{
echo "<script language='javascript'>";
echo "self.location="."'"."index.php'";
echo "</script>";
}
?>